<template>
	<view>
		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
<!--			<block slot="content">编辑资料</block>-->
		</cu-custom>
		<form>
			<view class="cu-form-group">
				<view class="title">邀请人</view>
				<input placeholder="请输入昵称" name="input" v-model="myFormData.inviteUser"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">邀请码</view>
				<input placeholder="账号" name="input" v-model="myFormData.inviteCode"></input>
			</view>

			<view class="padding flex flex-direction">
				<button class="cu-btn bg-blue lg"  @click="onSubmit">提交</button>
			</view>
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				index: -1,
				switchC: true,
				imgList: [],
				uploadUrl:"/sys/common/upload",
				myFormData:{
          inviteUser:'',
          inviteCode:'',
					bingCode:'',
				},
			};
		},
		onLoad: function (option) {
			console.log("this.$Route.query",this.$Route.query);
			let query=this.$Route.query
			if(query){
				this.myFormData=query;
			}
		},
		methods: {
			onSubmit() {
			  let myForm = this.myFormData
			  let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/);
			  let checkEmail = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
				this.$tip.loading();
				this.$http.put('/sys/user/appEdit',this.myFormData).then(res=>{
					console.log(res)
					this.$tip.loaded();
					if (res.data.success){
						this.$tip.toast('提交成功')
						this.$Router.replace({name:'userdetail'})
						/* uni.navigateTo({
							url: '/pages/user/userdetail'
						}) */
					}
				}).catch(()=>{
					this.$tip.loaded();
					this.$tip.error('提交失败')
				});
			},
			SwitchC(e) {
				this.switchC = e.detail.value
			},
		}
	}
</script>

<style>
	.cu-form-group .title {
		min-width: calc(4em + 15px);
	}
</style>
